#include "cpu/exec/template-start.h"

#define instr call

make_helper(concat5(instr, _, i, _, SUFFIX)) {
	int len = concat(decode_i_, SUFFIX)(eip + 1);
	cpu.esp -= DATA_BYTE;
	MEM_W(cpu.esp, cpu.eip + len + 1);
	cpu.eip += op_src->val;
	print_asm("call: 0x%x", cpu.eip + len + op_src->val + 1);
	return len + 1;
}

make_helper(concat5(instr, _, rm, _, SUFFIX)) {
	int len = concat(decode_rm_, SUFFIX)(eip + 1);
	cpu.esp -= DATA_BYTE;
	MEM_W(cpu.esp, cpu.eip + len + 1);
	cpu.eip = op_src->val - len - 1;
	print_asm("call: *%s", op_src->str);
	return len + 1;
}

#include "cpu/exec/template-end.h"